Gathering detailed insights and metrics for jsframe.js
Gathering detailed insights and metrics for jsframe.js
Gathering detailed insights and metrics for jsframe.js
Gathering detailed insights and metrics for jsframe.js
An independent lightweight multi-window library for javascript.
npm install jsframe.js
Typescript
Module System
Node Version
NPM Version
HTML (49.49%)
JavaScript (49.14%)
CSS (1.37%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
176 Stars
182 Commits
31 Forks
8 Watchers
5 Branches
2 Contributors
Updated on May 25, 2025
Latest Version
1.6.8
Package Id
jsframe.js@1.6.8
Unpacked Size
140.58 kB
Size
34.85 kB
File Count
7
NPM Version
6.14.17
Node Version
14.21.2
Published on
Aug 09, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
It is an independent and lightweight multi-window library for javascript.
It is licensed under MIT license.
1npm install jsframe.js --save
1import { JSFrame } from 'jsframe.js';
1const { JSFrame } = require('jsframe.js');
1<script src="https://cdn.jsdelivr.net/npm/jsframe.js/lib/jsframe.min.js"></script>
Here's is basic example of JSFrame.js to show a simple window.
JSFrame.create
method with initialization parameter to show a windowframe.show
to show the window1const jsFrame = new JSFrame(); 2//Create window 3const frame = jsFrame.create({ 4 title: 'Window', 5 left: 20, top: 20, width: 320, height: 220, 6 movable: true,//Enable to be moved by mouse 7 resizable: true,//Enable to be resized by mouse 8 html: '<div id="my_element" style="padding:10px;font-size:12px;color:darkgray;">Contents of window</div>' 9});
DEMO
https://riversun.github.io/jsframe/examples/v150/simple.html
Tips
frame.$([selector])
const ele = frame.$('#my_element')
frame.setPosition(x,y,[anchor]);
If you specify an anchor, the location of the anchor will be the specified x,y coordinate.
Anchor values 'LEFT_TOP','CENTER_TOP','RIGHT_TOP','LEFT_CENTER','CENTER_CENTER','RIGHT_CENTER','LEFT_BOTTOM','CENTER_BOTTOM','RIGHT_BOTTOM'
frame.setHTML(`<div>Your content</div>`);
1const windowName='my-example-window'; 2frame.setName(windowName);
and you can get the window by windowName
1const windowName='my-example-window'; 2const frame=jsFrame.getWindowByName(windowName);
You can use it in the following cases. Show window if it exists, create new window if window is closed
1const windowName='my-example-window'; 2const windowExists=jsFrame.containsWindowName(windowName);
url
to the initialization parameter.urlLoaded
1const frame01 = jsFrame.create({ 2 title: 'Window1', 3 left: 20, top: 20, width: 320, height: 160, 4 url: 'iframe_content01.html',//URL to display in iframe 5 //urlLoaded:Callback function called after loading iframe 6 urlLoaded: (frame) => { 7 //Called when the url finishes loading 8 } 9}); 10frame01.show();
DEMO
https://riversun.github.io/jsframe/examples/v150/iframe.html
Tips
frame.$('#my_element')
.frame.showModal
to show the window as a modal window.showModal(callbackFunc)
you can receive a callback when the modal window is closed.1const modalFrame = jsFrame.create({ 2 title: 'modal window', 3 left: 0, top: 0, width: 320, height: 220, 4 html: 'something' 5 }); 6 //Show as a modal window 7 modalFrame.showModal(_frame => { 8 //Callback when modal window is closed. 9 });
DEMO
https://riversun.github.io/jsframe/examples/v150/modal.html
appearanceName
to initialization parameter to select the window design called appearance
.appearance
to initialization parameter.Style from preset
1const frame01 = jsFrame.create({ 2 title: 'Yosemite style', 3 left: 20, top: 20, width: 320, height: 220, 4 appearanceName: 'yosemite',//Now preset is selectable from 'yosemite','redstone','popup' 5 style: { 6 backgroundColor: 'rgba(255,255,255,0.9)', 7 }, 8 html: '<div style="padding:10px;">Preset is selected by preset name</div>' 9}).show();
DEMO
https://riversun.github.io/jsframe/examples/v150/styling.html
frame.on(selector,'click',(_frame,event)=>{});
to set click event handler functions.1//Set click handler for DOM element specified as html or url in the initialization parameters. 2frame.on('#bt_cancel', 'click', (_frame, evt) => { 3}); 4 5//Event handler for buttons on the title bar. 6frame.on('minimizeButton', 'click', (_frame, evt) => { 7}); 8
DEMO
https://riversun.github.io/jsframe/examples/v150/event_handling.html
duration
.JSFrame.showToast
to show a toast.Simple toast
1const jsFrame = new JSFrame();
2 jsFrame.showToast({
3 html: 'Default toast'
4 });
Specify the position
1jsFrame.showToast({
2 align: 'center', html: 'Toast displayed in the center'
3});
You can specify the position with align
like below.
align:'top' =>Toast displayed at the top
align:'center' =>Toast displayed in the center
align:'bottom' =>Toast displayed at the bottom(default)
Customize toast
1jsFrame.showToast( 2 { 3 width: 260, 4 height: 100, 5 duration: 2000,//Duration(millis) 6 align: 'center',// alignment from 'top'/'center'/'bottom'(default) 7 style: { 8 borderRadius: '2px', 9 backgroundColor: 'rgba(0,124,255,0.8)', 10 }, 11 html: '<span style="color:white;">Custom toast</span>', 12 closeButton: true,//Show close button 13 closeButtonColor: 'white'//Color of close button 14 }); 15
DEMO
https://riversun.github.io/jsframe/examples/v150/toast.html
You can use font-awesome for titlebar icons.
For material, describe the settings using appearanceParam as below.
1{ 2name: `Win2`, 3title: `Material style`, 4left: 360, top: 40, width: 320, height: 220, minWidth: 200, minHeight: 110, 5appearanceName: 'material', 6appearanceParam: { 7 border: { 8 shadow: '2px 2px 10px rgba(0, 0, 0, 0.5)', 9 width: 0, 10 radius: 6, 11 }, 12 titleBar: { 13 color: 'white', 14 background: '#4784d4', 15 leftMargin: 40, 16 height: 30, 17 fontSize: 14, 18 buttonWidth: 36, 19 buttonHeight: 16, 20 buttonColor: 'white', 21 buttons: [ // buttons on the right 22 { 23 //Set font-awesome fonts(https://fontawesome.com/icons?d=gallery&m=free) 24 fa: 'fas fa-times',//code of font-awesome 25 name: 'closeButton', 26 visible: true // visibility when window is created. 27 }, 28 { 29 fa: 'fas fa-expand-arrows-alt', 30 name: 'maximizeButton', 31 visible: true 32 }, 33 { 34 fa: 'fas fa-compress-arrows-alt', 35 name: 'minimizedButton', 36 visible: false 37 }, 38 ], 39 buttonsOnLeft: [ //buttons on the left 40 { 41 //Set font-awesome fonts(https://fontawesome.com/icons?d=gallery&m=free) 42 fa: 'fas fa-bars', 43 name: 'menu', 44 visible: true, 45 //html to show when this button is clicked. 46 childMenuHTML: '<div class="list-group">' + 47 ' <div name="menu1" class="list-group-item list-group-item-action py-2">Menu Item 01</div>' + 48 ' <div name="menu2" class="list-group-item list-group-item-action py-2">Menu Item 02</div>' + 49 ' <div name="menu3" class="list-group-item list-group-item-action py-2">Menu Item 03</div>' + 50 '</div>', 51 childMenuWidth: 300 52 }, 53 ], 54 }, 55}, 56style: { 57 backgroundColor: 'rgba(0,0,0,0.8)', 58 overflow: 'hidden', 59 width: '100%', 60}, 61 62html: 'something' 63}
Close window
1frame.closeFrame();
Hide Window
1frame.hide();
Focus window (and pull up to the front)
1frame.requestFocus();
Get window by name
1var frame = jsFrame.getWindowByName('my-window');
Setting frame#setControl enables the mode to automatically change the window size when the button on the title bar is pressed.
1frame.setControl({
2 maximizeButton: 'maximizeButton',//Name of the button on framecomponent to maximize when pressed.
3 demaximizeButton: 'restoreButton',//Name of the button on framecomponent to de-maximize when pressed.
4 maximizeWithoutTitleBar: true,//If true,hide the title bar and maximize the content part.
5 restoreKey: 'Escape',//If maximizeWithoutTitleBar is true,de-maximize the window when the key specified here is pushed.
6 minimizeButton: 'minimizeButton',//Name of the button on framecomponent to minimize when pressed.
7 deminimizeButton: 'deminimizeButton',//Name of the button on framecomponent to de-minimize when pressed.
8 hideButton: 'closeButton',//Name of the button on framecomponent to hide when pressed.
9 animation: true,//If true,execute animation during window size changing
10 animationDuration: 150,//Duration of animation
11 });
DEMO https://riversun.github.io/jsframe/examples/v150/window_control.html
1frame.control.on('maximized', (frame, info) => { 2 jsFrame.showToast({ 3 text: 'Press "ESC" to minimize.', align: 'center' 4 }); 5 });
EventType | Description |
maximized | Called when maximazation is finished. |
demaximized | Called when de-maximazation is finished. |
minimized | Called when minimization is finished. |
deminimized | Called when de-minimization is finished. |
hid | Called when hiding is finished. |
dehided | Called when de-hiding is finished. |
You can write window size operation manually like below
1
2 frame.on('maximizeButton', 'click', (_frame, evt) => {
3
4 _frame.control.doMaximize({
5 hideTitleBar: false,
6 duration: 200,
7 restoreKey: 'Escape',
8 restoreDuration: 100,
9 callback: (frame, info) => {
10 frame.requestFocus();
11 },
12 restoreCallback: (frame, info) => {
13 jsFrame.showToast({
14 text: frame.getName() + ' ' + info.eventType
15 });
16 },
17 });
18 });
1this.jsFrame = new JSFrame({ 2 fixed:true,//(Default)If true, it will be fixed to the screen even if the contents (background) scrolls. 3 parentElement:document.body,//Set element to attach jsFrame. 4 horizontalAlign: 'right',// If 'right' is set, the anchor is set at the right edge.If you specify the position of frame with 'left' in this mode, Make the value negative.Default is 'left' 5 verticalAlign: 'bottom',//If 'bottom' is set, the anchor is set at the bottom edge.Default is 'bottom' 6}); 7
1const frame = jsFrame.create( 2 { 3 name: 'my-window-name',//Window name.Unique name is required. 4 title: 'Window0',//Window title 5 left: 20,//x coordinate of the upper left corner of the window 6 top: 20,//y coordinate of the upper left corner of the window 7 width: 320,//width of the window 8 height: 220,//height of the window 9 minWidth: 160,//The minimum width of the window 10 minHeight: 100,//The minimum height of the window 11 movable: true,//true:You can move the window with mouse 12 resizable: true,//true:You can resize the window with mouse 13 appearance: appearanceObj,//Appearance object 14 appearanceName: 'yosemite',//Preset name of appearance(Not with 'appearance') 15 style: {//Style of the content.Can be specified just like inline style attribute. 16 backgroundColor: 'rgba(220,220,220,0.8)',//Ex.Background color of content(Opacity can be specified) 17 overflow: 'auto',//Ex.What to do when the drawing extends beyond the content area 18 }, 19 html: 'Contents',//HTML shown in the content(Not with 'url') 20 url: 'content01.html',//The URL for contents.To be shown in iframe. 21 urlLoaded: (frame) = {}//Callback function when url is finished loading. 22 23 });
After install jsframe.js , you can use it like below.
1import {JSFrame} from 'jsframe';
You can add an alias in your webpack config like this:
1module.exports = { 2 ... 3 resolve: { 4 alias: { 5 'jsframe': 'jsframe.js/dist/jsframe.min.js', 6 } 7 }, 8 ... 9}; 10
All examples are included in the project. You can modify,customize example after cloning the project
git clone https://github.com/riversun/JSFrame.js.git
Methods | Details |
---|---|
CIfFrame createFrame(left, top, width, height, CFrameAppearance) | create CIFFrame instance.CIfFrame is a kind of 'window' called frame. |
CFrameAppearance createFrameAppearance() | create CFrameAppearance instance. CFrameAppearance is a class for frame appearance.You can modify frame's looking as you like. |
Methods | Details |
---|---|
CIfFrame setTitle(str) | Set caption in the title bar |
CIfFrame setResizable(boolean) | Set whether the window can be resized |
CIfFrame setMovable(boolean) | Set whether the window can be moved |
CIfFrame setTitleBarClassName(classNameForDefault, classNameForFocused) | Set title bar style class name |
Object getFrameView() | Get window content element. It's just a 'div' element.So you can handle it as a 'div' element. ex) frame.getFrameView().innerHTML='xxxx'; |
Promise setUrl(url) | Open a page specified as url in the IFrame mode. It returns Promise.If you want to execute something at the timing of opening url,use 'then' . ex) frame.setUrl('http://something').then(function(){frame.show();}); |
CIfFrame show() | Show frame |
CIfFrame requestFocus() | Requests that this frame gets the focus. Focus and the window comes to the forefront |
CIfFrame setSize(width,height) | set size of frame |
CIfFrame setPosition(x,y,anchor) | anchor is optional. Default anchor is 'LEFT_TOP' You can set followings for anchor. 'LEFT_TOP', 'CENTER_TOP', 'RIGHT_TOP', 'LEFT_CENTER', 'CENTER_CENTER', 'RIGHT_CENTER', 'LEFT_BOTTOM', 'CENTER_BOTTOM', 'RIGHT_BOTTOM' |
Methods | Details |
---|---|
CFrameAppearance setUseIFrame(boolean) | If 'true' ,You can set CIfFrame 'IFrame mode' and you can use CIfFrame#setUrl method for opening specified url. |
void onInitialize() | Since this callback method is called at frame initialization,Initialization processing such as adding frameComponent should be written here. |
Members | Details |
---|---|
showTitleBar | true or false |
showCloseButton | true or false |
titleBarCaptionFontSize | ex)'12px' |
titleBarCaptionFontWeight | ex)'bold' |
titleBarHeight | ex)'24px' |
titleBarCaptionLeftMargin | ex)'10px' |
titleBarColorDefault | Color for not focused state. ex)'#dddddd' |
titleBarColorFocused | Color for focused state. ex)'white' |
titleBarCaptionColorDefault | Color for not focused state. ex)'black' |
titleBarCaptionColorFocused | Color for focused state. ex)'red' |
titleBarBorderBottomDefault | Style for bottom of the title bar. ex)'1px solid rgba(0,0,0,0.2)' |
titleBarBorderBottomFocused | If null,'titleBarBorderBottomDefault' will be applied. |
frameBorderRadius | Corner radius of the window. ex)'6px' |
frameBorderWidthDefault | Width of border line in the not focused state. ex)'1px' |
frameBorderWidthFocused | Width of border line in the focused state. ex)'1px' |
frameBorderColorDefault | Color of border line in the not focused state. ex)'rgba(1, 1, 1, 0.2)' |
frameBorderColorFocused | Color of border line in the focused state. ex)'rgba(1, 1, 1, 0.2)' |
frameBorderStyle | Border line style ex)solid |
frameBoxShadow | Shadow style of the frame ex) '5px 5px 10px rgba(0, 0, 0, 0.3)' |
frameBackgroundColor | Background color of the frame ex)'white' |
DEMO
https://riversun.github.io/jsframe/examples/ex01/index.html
DEMO
https://riversun.github.io/jsframe/examples/ex02/index.html
DEMO
https://riversun.github.io/jsframe/examples/ex03/index.html
DEMO
https://riversun.github.io/jsframe/examples/ex04/index.html
DEMO
https://riversun.github.io/jsframe/examples/ex05/index.html
DEMO
https://riversun.github.io/jsframe/examples/ex06/index.html
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
33 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More